module GradebookHelper
  ##
  # Finds the user_answers to the corresponding exam
  # @param exam is a instance of an ExamResult whose user-answers should be 
  #        found
  # @param user is the user whose answers should be found
  def find_user_answers(exam, user)
    user_answers = Array.new
    exam.questions.each do |q| 
      q.answers.each do |a|
        a.user_answers.each do |ua|
	        user_answers << ua if ua.user == user
        end
      end
    end
    return user_answers
  end
end
